package LC;

/**
 * @ClassName LC338
 * @Description: TODO
 * @Author hl
 * @Date 2020/10/3
 * @Version V1.0
 **/
public class LC338 {
    public int[] countBits(int num) {
     int []arrs=new int[num+1];
     int i=0,b=1;
     while(i<num){
         while(i<b&&i+b<=num){
             arrs[i+b]=arrs[i]+1;
             i++;
         }
         i=0;
         b=b*2;
     }
     return  arrs;
    }
}
